home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jaz_clib.arc / JZCLOCK.DMO < prev    next >
Text File  |  1989-04-09  |  2KB  |  68 lines

  1. /*
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │clock.dmo                                     │
  4. │Install a clock interrupt handler for Ms/C                     │
  5. │                                         │
  6. │Notes: This routine eats up tons of memory but it is just an example of     │
  7. │how to write a terminate but stay resident routine in ms/c             │
  8. │                                         │
  9. │ (C) JazSoft Software by Jack A. Zucker (301) 794-5950              │
  10. └────────────────────────────────────────────────────────────────────────────┘
  11. */
  12.  
  13.  
  14. #include <jaz.h>
  15. #include <jzscreen.h>
  16.  
  17. int clock();
  18. int gcount = 17;            /* clock tic counter */
  19. #define COPYWRITE "JZCLOCK  (C) JazSoft 1986 by Jack A. Zucker @ 301-794-5950 |\
  20.  CIS: 75766,1336"
  21. #define TIMER 0x1C
  22.  
  23. main()
  24. {
  25.  
  26.   int wscan;
  27.  
  28.   jzlogo();        /* paint the logo onto the screen */
  29.  
  30.   cls(CYAN);
  31.   jzscrprn(COPYWRITE,0,0,YELLOW);
  32.  
  33.   jzloccur(2,0);
  34.   printf("This program simply demonstrates how easy it is to");
  35.   printf("\ninstall an interrupt handler in your \"C\" routines.");
  36.   printf("\nSimply declare the user routine as a global function");
  37.   printf("\nand call jzinsint() to install the interrupt.");
  38.   printf("\n\nFor information regarding source code for the JazSoft C Library:");
  39.   printf("\ncall @ 301-794-5950 | 301-794-8763 | CIS: 75766,1336");
  40.   printf("\nor send $25 for the complete library of over 100 functions");
  41.   printf("\nincluding source code!");
  42.   printf("\n-Jaz");
  43.   printf("\n\nPress <Enter> to continue...");
  44.  
  45.   do ; while (jzinkey(&wscan) != 13); /* wait for enter key */
  46.  
  47.   cls(7);
  48.  
  49.   jzinsint(TIMER,clock);     /* install the new timer interrupt */
  50.  
  51.   jztrmres();            /* terminate but stay resident */
  52.  
  53. }
  54.  
  55. clock()
  56. {
  57.    char wstr[9];
  58.  
  59.    if (gcount >= 17) {
  60.      jzbiostm(wstr);
  61.      jzscrprn(wstr,0,72,RED);
  62.      gcount = 0;
  63.    }
  64.    else
  65.      gcount ++;
  66. }
  67.  
  68.